﻿using System;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;
using Ext.Net;
using Sharp.Portal;
using Sharp.Portal.ExtNet;
using Sharp.Portal.Mvc;
using Sharp.Portal.Mvc.Form;

namespace Sharp.WebBooter.Areas.Platform.Models
{
    /// <summary>
    /// 组织机构
    /// </summary>
    public partial class OrgViewModel : ISharpForm
    {
        public OrgViewModel()
        {
            UI = new ExtSharpFrom(this);
        }
        [HiddenInput]
        public Guid Id { get; set; }

        /// <summary>
        /// 编码
        /// </summary>
        [Display(Name = "编码")]
        public string Code { get; set; }

        /// <summary>
        /// 名称
        /// </summary>
        /// <value>标题</value>
        [Display(Name = "名称")]
        public string Title { get; set; }
        /// <summary>
        /// 简称
        /// </summary>
        [Display(Name = "简称")]
        public string Abbreviation { get; set; }
        /// <summary>
        /// 上级
        /// </summary>
        [Display(Name = "归属"), CustomField(FieldType.OrgTreeList, dataSourceName: nameof(OrgTree))]
        public System.Guid? ParentId { get; set; }
        /// <summary>
        /// 层级Id
        /// </summary>
        [Display(Name = "层级")]
        public Guid? OrgLevelId { get; set; }

        /// <summary>
        /// 编制
        /// </summary>
        [Display(Name = "编制")]
        public int? MaxHeadcount { get; set; }


        /// <summary>
        /// 备注
        /// </summary>
        /// <value>备注</value>
        [Display(Name = "备注"), DataType(DataType.MultilineText)]
        public string Remark { get; set; }


        public Node OrgTree { get; set; }
        public SharpFrom UI { get; set; }

        [Section("工作岗位", ItemsFromAction = "Index,Job",RouteValues = "new { OrgId = Model.Id }")]
        public JobIndexModel Job { get; set; }
    }
}